import { legacy_createStore as createStore, applyMiddleware } from 'redux';
import thunk from 'redux-thunk';
import logger from 'redux-logger';
import promise from 'redux-promise';
import reducer from './reducer';

const middleware = [thunk, promise]
if (process.env.NODE_ENV === 'development') {
  middleware.push(logger)
}

const store = createStore(
  reducer,
  applyMiddleware(...middleware)
)

export default store